using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MeleeAttack : MonoBehaviour
{
    public AudioClip audioClip;
    public MeleeHitbox meleeHitbox;
    private Vector2 rightMeleeAttackOffset;
    public AudioSource audioSource;
    private Collider2D colliderHitbox;

    void Start()
    {
        colliderHitbox = meleeHitbox.GetComponent<Collider2D>();
        rightMeleeAttackOffset = meleeHitbox.transform.position;
    }

    void Update()
    {
        
    }

    public void StartAttack(bool isFlipped)
    {
        audioSource.PlayOneShot(audioClip);
        
        if (!isFlipped) 
        {
            colliderHitbox.transform.localPosition = new Vector2(0.3f, 0);
        } else 
        {
            colliderHitbox.transform.localPosition = new Vector2(0.3f * -1, 0);
        }
        colliderHitbox.enabled = true;
    }

    public void StopAttack()
    {
        colliderHitbox.enabled = false;
    }
}
